package com.itbaizhan.openhis.controller.sms;

import com.itbaizhan.openhis.service.VerificationCodeService;
import com.itbaizhan.openhis.vo.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 短信发送控制层
 */
@RestController
@Slf4j
@RequestMapping("system/sms")
public class SmsSendController {
	// @DubboReference 注解引入远程服务 ,  dubbo 3.0以上版本
	//@Reference适用于dubbo 2.7.x以上版本
	@Reference
	private VerificationCodeService verificationCodeService;
	
	/**
	 * 获取验证码
	 * @param phoneNumber
	 * @return
	 */
	@PostMapping("sendSms/{phoneNumber}")
	public AjaxResult acquireVerificationCode(@PathVariable String phoneNumber) {
		log.info("获取验证码开始");
		int row = verificationCodeService.sendSms(phoneNumber);
		return AjaxResult.toAjax(row);
	}
}
